home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0031_SETMODE7.PAS.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  32 lines

  1. I heard (read?) that you wanted to find out how to do 256-colour Graphics.
  2. Here are some Procedures For you.
  3.  
  4. Uses Dos;   { if your Program doesn't already :) }
  5.  
  6. Procedure SetGrMode(grMode : Byte);  { enters a given Graphics mode }
  7. { does *not* check For presence of VGA -- use With caution!! }
  8. Var
  9.    r : Registers;
  10. begin
  11.      r.AX := grMode;
  12.      Intr($10, R);
  13. end;
  14.  
  15. Procedure PutPixel256(p_x, p_y : Integer; p_c : Byte);
  16. begin
  17.      Mem[$A000 : p_y * 320 + p_x] := p_c;
  18. end;
  19.  
  20. OK, With the SetGrMode Procedure, to enter 256-colour mode, call the Program
  21. with a value of $13.  So:  SetGrMode($13);
  22. And to return to Text mode, call:  SetGrMode($03);
  23. The second Procedure is self-explanatory, With a few bits of info required.
  24. The valid co-ords are 0..319 (horizontal) x 0..199 (vertical), so you can't use
  25. GetMaxX or GetMaxY, unless you define them as Constants in the beginning of
  26. your Program.  The colour is in the range 0..255.
  27.  
  28. *WARNING*  These Procedure will not work together With a BGI driver or the
  29. Graph Unit.  If you enter Graphics mode With my Procedure, you will not be able
  30. to output Text, boxes, circles, etc. unless you Write your own Procedures for
  31. the above.
  32.